﻿package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016102400752723";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCdfD4davvZky2gyNK809TCalwiCQ0S2HBsPjY+ldY3HkwY6HyQaGXo8LHRtINPBheScG8i+YEt2eKzW4vYb+sDOT4bqfzOLUJzsy1pkxz1Xe4RXg29VkSOs/yPwGMQoxiG6SrIXQYKwEs4hURP8SCsB2t2GMpc5cFciXQWlac40ZAUWSUJrymTps25Hu/NbOvRajeGYC4pZISfHtq4+tIlbvHBnBZLmWNTjoaky6eXFEtZtsCAYUINp/bL1xp/iWf8rN3N2aGlnXRHoHJmvXpFBunpwzR9iFYVa1HEerhQgDw3Mbrj1ju3c4FksT6+/3nDQweqO5byVXaKjWTej5zfAgMBAAECggEAFQRBnddrKMwVaMGkLgLu/8sF5Jzkm8E6r5dV0eBZKB3o9eIAzZzBDOciM+QtKdycRLSwgDBf5uiO8nSjIw08hb+b5EE5NaKgnaQpyU8SrEQOw06T8tKSb6DhcaWxEsVRPp/bT8XqSoEDCNXwGeMKAysyUh5Y0zDuLxVA4sqx+Ej4tGH6CkNGUw992UhChjm9wIfNbMisRyjFV3c9yQFxLnkqY5L5ugV/y9HIPbC2Zj5XE/6AdUXOv09+wXhiNMri1hVdmcp5fCytusUOb15XkbgIA6pJssLAw2WIC3fW5xB1sAkq3gDd5wI+BKcYKydotPMnZuDIbWdAlSkuh0WGMQKBgQDx+G92641/36h/YfoZZ8QkhuVM8m4/xJ2Ybp2bjw1yWJF34GX/TYBskTMXDO/44SzTmQ+LuDA1/7T/sbuBv4w9AhP7nwmE39fmui/mnToWWOUyMAw4PYZjGMjLpck1YUWI+TLGV/PE2YmmQAzJ5w/486wHT+3eiLCNOnpLwuj0TQKBgQCmncui3u1eWdh2PiTI3CN7LgXTM+9TB9d5niKbl8XagThOeqp9aQQg7b+ZDkI+Zp4xukjTJGLOb8OahTRed5mosloFChsB8RZXpv/CvqkQNPftW6Fm/4psGploaQs+eTqtm5P5bfpaEXviySsxoZAz0aSSllx+N6jVg4oBCMyb2wKBgFD1BR4tq3cYNsD/3/S2EhsCgx+ekSKGvw+sGtFcKGyUk38fNiEYJhqs7gINUxDbDetx75CYvJCkkENojMrZcqtK0bLDQCUT26GXs8Ud37xwW6bSCpSaiScIuM3iFxLkC6bLcaCI9sdq3TIhheXbiC2MIYeEx5pH84IdCaPlf5mVAoGAfrzK2GIQVtOq1w6gNnVVO+6fGa+InTT6z5TdKFODeZkPdorSQsDuFgoi0s7IzuSJ8rOLj6g+zF6xgElQs4bwSCUaWnj8YDa90wDBzaXvvdc8u70Wgd1hsqdtB8HXfrcCTmpoXbQtWfOws6poA8Gsie4u7B4ZzxyRfZAoGm9SDD8CgYEAtnUrVw1jHBjBQvh5b27jGbCSDz6kvA92e+kX8Tt9+TkujfX5wKG6QKyDiGUyJDPkBWQIeBnK6k1OrMpit7iTz4E3kd3PR7nIzUON60vJsP5oF9S1QWtfBSrkDc++OYEe6WNgYADQ4lwY1w4vbyMn7N1uLDV4nhFyRBkykw04T58=";
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDIgHnOn7LLILlKETd6BFRJ0GqgS2Y3mn1wMQmyh9zEyWlz5p1zrahRahbXAfCfSqshSNfqOmAQzSHRVjCqjsAw1jyqrXaPdKBmr90DIpIxmIyKXv4GGAkPyJ/6FTFY99uhpiq0qadD/uSzQsefWo0aTvP/65zi3eof7TcZ32oWpwIDAQAB";
	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/fresh/front/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/fresh/index.html";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "D:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
    
    
 

 	


}

